<script setup>
import { defineProps,getCurrentInstance } from 'vue';
const { $t } = getCurrentInstance().proxy;
const props = defineProps({
  userName: String,
  payInfo: Object
});
const levelMap = {
  plum: $t("plumVip"),
  gold: $t("goldVip"),
  super: $t("superVip")
};
const benefitMap = {
  plum: [$t("plumBenefit1"), $t("plumBenefit2"), $t("plumBenefit3")],
  gold: [$t("goldBenefit1"), $t("goldBenefit2"), $t("goldBenefit3")],
  super: [$t("superBenefit1"), $t("superBenefit2"), $t("superBenefit3"), $t("superBenefit4")]
};
</script>

<template>
  <div class="pay-left-vip">
    <div class="user-nick">{{ $t('greeting') }}<span>{{ userName }}</span></div>
    <div class="vip-info">
      <h2 class="vip-title">{{ $t("buy") }}: {{ levelMap[props.payInfo.level] }}</h2>
      <ul class="vip-benefits">
        <li v-for="b in benefitMap[props.payInfo.level]" :key="b">{{ b }}</li>
      </ul>
      <div class="vip-price">{{ $t("pay") }}：<span>￥{{ props.payInfo.total }}</span></div>
    </div>
    <div class="pay-tip">{{ $t("payTips") }}</div>
  </div>
</template>

<style scoped>
.pay-left-vip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--card-bg);
  border-radius: 16px;
  min-width: 320px;
  padding: 20px;
}
.user-nick {
  font-size: 1.1rem;
  color: var(--h4-color);
  font-weight: 600;
  margin-bottom: 18px;
}
.vip-info {
  width: 100%;
  margin-bottom: 18px;
}
.vip-title {
  font-size: 1.5rem;
  color: #e67e22;
  margin-bottom: 10px;
  font-weight: bold;
}
.vip-benefits {
  margin: 0 0 16px 0;
  padding: 0 0 0 18px;
  color: var(--pay-tx);
  font-size: 1rem;
}
.vip-benefits li {
  margin-bottom: 6px;
}
.vip-price {
  font-size: 1.2rem;
  color: var(--h4-color);
  margin-bottom: 8px;
}
.vip-price span {
  color: #e67e22;
  font-weight: bold;
  font-size: 1.3rem;
}
.pay-tip {
  margin-top: 18px;
  color: #888;
  font-size: 0.98rem;
  border-top: 1px dashed #eee;
  padding-top: 12px;
  width: 100%;
  text-align: center;
}
</style>